﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Zero.UControl.Demo.Models;

namespace Zero.UControl.Demo.Views
{
    /// <summary>
    /// Interaction logic for ViewA.xaml
    /// </summary>
    public partial class ScrollView : UserControl
    {
        public List<string> Headers { get; set; }
        public ObservableCollection<MachineInfo> Machines { get; set; } = new ObservableCollection<MachineInfo>();

        public Brush HeaderBkColor { get; set; } = new SolidColorBrush(Color.FromRgb(147, 107, 199));
        public Brush HeaderBorderBrush { get; set; } = new SolidColorBrush(Color.FromRgb(61, 113, 255));
        public double HeaderBorderThickness { get; set; } = 1d;
        public Brush HeaderForeground { get; set; } = Brushes.White;
        public HorizontalAlignment HeaderHorizontalAlignment { get; set; } = HorizontalAlignment.Center;
        public VerticalAlignment HeaderVerticalAlignment { get; set; } = VerticalAlignment.Center;
        public double HeaderFontSize { get; set; } = 16d;
        public FontWeight HeaderFontWeight { get; set; } = FontWeight.FromOpenTypeWeight(550);
        public ScrollView()
        {
            InitializeComponent(); 
            Loaded += ScrollView_Loaded;
            Headers = new List<string>() { "编号", "名称", "流程", "状态", "日期" };
        }

        private void ScrollView_Loaded(object sender, RoutedEventArgs e)
        {
            Machines.Clear();
            for (int i = 0; i < 20; i++)
            {
                Machines.Add(new MachineInfo()
                {
                    Id = i,
                    Name = "机器A" + i.ToString().PadLeft(3, '0'),
                    FlowName = i % 1 == 0 ? "切割" : (i % 2 == 0 ? "打磨" : (i % 3 == 0 ? "抛光" : "镀铜")),
                    State = i % 4 == 0 ? "正常" : "出错",
                    RunTime = DateTime.Now
                });
            }
        }
    }
}
